﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Scheduler.aspx.cs" Inherits="Scheduler" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>زمان کاری پزشکان</title>
    <link href="App_Themes/Default/css/styles.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function pageLoad(sender, eventArgs) {
            // Prevent the double click event from bubbling out of the inline template
            $telerik.$(".rsAptEditSizingWrapper").bind("dblclick", function (e) { e.stopPropagation(); });
        }
    </script>
    <style type="text/css">
        .rsCustomAppointmentContainer div
        {
            width: 100% !important;
        }
        .rsCustomAppointmentContainer h2
        {
            overflow: hidden !important;
            white-space: nowrap !important;
            text-overflow: ellipsis !important;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="text-align: center">
        <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="PatientScheduler">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="PatientScheduler" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadScheduler runat="server" ID="PatientScheduler" Width="100%" Height="100%"
            DataSourceID="AppointmentsEntityDataSource" DataKeyField="Id" DataSubjectField="Subject"
            DataStartField="Start" DataEndField="End" OnFormCreated="PatientScheduler_FormCreated"
            OverflowBehavior="Auto" OnFormCreating="PatientScheduler_FormCreating" FirstDayOfWeek="Saturday"
            HoursPanelTimeFormat="H:mm" LastDayOfWeek="Thursday" TimeZoneID="Iran Standard Time"
            Skin="Office2010Blue" TimeZoneOffset="03:30:00" ShowFullTime="false"
            NumberOfHoveredRows="0" EnableRecurrenceSupport="false" AppointmentStyleMode="Default">
            <AdvancedForm Modal="true"></AdvancedForm>
            <AppointmentContextMenus>
                <%--The appointment context menu interaction is handled on the client in this example--%>
                <%--See the JavaScript code above--%>
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerAppointmentContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="ویرایش" Value="CommandEditAppointment" ImageUrl="App_Themes/Default/Images/edit.gif">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem IsSeparator="True">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="حذف" Value="CommandDelete" ImageUrl="App_Themes/Default/Images/delete.gif">
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </AppointmentContextMenus>
            <TimeSlotContextMenus>
                <telerik:RadSchedulerContextMenu runat="server" ID="SchedulerTimeSlotContextMenu">
                    <Items>
                        <telerik:RadMenuItem Text="زمان کاری جدید" ImageUrl="App_Themes/Default/Images/newAppointment.jpg"
                            Value="CommandAddAppointment">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem IsSeparator="true">
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem Text="برو به امروز" Value="CommandGoToToday">
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadSchedulerContextMenu>
            </TimeSlotContextMenus>
            <WeekView ColumnHeaderDateFormat="ddd, dd" />
            <ResourceTypes>
                <telerik:ResourceType KeyField="Id" Name="Room" TextField="Name" ForeignKeyField="RoomId"
                    DataSourceID="RoomsEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="Doctor" TextField="FirstName" ForeignKeyField="DoctorId"
                    DataSourceID="DoctorsEntityDataSource"></telerik:ResourceType>
                <telerik:ResourceType KeyField="Id" Name="AppointmentType" TextField="Name" ForeignKeyField="AppointmentTypeId"
                    DataSourceID="AppointmentTypesEntityDataSource"></telerik:ResourceType>
            </ResourceTypes>
            <InlineInsertTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Insert"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label5" AssociatedControlID="StartInput" runat="server" CssClass="inline-label">زمان شروع:</asp:Label>
                            <telerik:RadDateInput ID="StartInput" SelectedDate='<%# Bind("Start") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput>                            
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndInput" runat="server" CssClass="inline-label">زمان پایان:</asp:Label>
                            <telerik:RadDateInput ID="EndInput" SelectedDate='<%# Bind("End") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentTypeComboBox" runat="server" CssClass="inline-label">نوع ملاقات:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="AppointmentTypeComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("AppointmentTypeId") %>'
                                DataSourceID="AppointmentTypesEntityDataSource">
                            </telerik:RadComboBox>
                            <asp:DropDownList ID="DropDownList1" runat="server"  DataTextField="Name"
                                DataValueField="Id" Width="90%" SelectedValue='<%# Bind("AppointmentTypeId") %>'
                                DataSourceID="AppointmentTypesEntityDataSource">
                            </asp:DropDownList>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="DoctorsComboBox" runat="server" CssClass="inline-label">نام پزشک:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="DoctorsComboBox" DataTextField="FirstName"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorId") %>'
                                DataSourceID="DoctorsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="RoomsComboBox" runat="server" CssClass="inline-label">محل حضور:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="RoomsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("RoomId") %>' DataSourceID="RoomsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Insert" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="insert"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </InlineInsertTemplate>
            <InlineEditTemplate>
                <div id="qsfexAdvEditWrapper" dir="rtl">
                    <div id="qsfexAdvEditInnerWrapper" class="technical">
                        <div class="qsfexAdvAppType">
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label4" AssociatedControlID="SubjectTextBox" runat="server" CssClass="inline-label">عنوان: </asp:Label>
                            <asp:TextBox ID="SubjectTextBox" Rows="2" Columns="20" runat="server" Text='<%# Bind("Subject") %>'
                                Width="97%" TextMode="MultiLine"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="SubjectRequiredFieldValidator" runat="server" ValidationGroup="Update"
                                ControlToValidate="SubjectTextBox" ErrorMessage="عنوان اجباری">*</asp:RequiredFieldValidator>
                            <br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label5" AssociatedControlID="StartInput" runat="server" CssClass="inline-label">زمان شروع:</asp:Label>
                            <telerik:RadDateInput ID="StartInput" SelectedDate='<%# Bind("Start") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label6" AssociatedControlID="EndInput" runat="server" CssClass="inline-label">زمان پایان:</asp:Label>
                            <telerik:RadDateInput ID="EndInput" SelectedDate='<%# Bind("End") %>' runat="server"
                                EnableSingleInputRendering="false">
                            </telerik:RadDateInput><br />
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label3" AssociatedControlID="AppointmentTypeComboBox" runat="server" CssClass="inline-label">نوع ملاقات:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="AppointmentTypeComboBox" DataTextField="Name"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("AppointmentTypeId") %>'
                                DataSourceID="AppointmentTypesEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label1" AssociatedControlID="DoctorsComboBox" runat="server" CssClass="inline-label">نام پزشک:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="DoctorsComboBox" DataTextField="FirstName"
                                DataValueField="Id" Width="90%" Skin="Office2007" SelectedValue='<%# Bind("DoctorId") %>'
                                DataSourceID="DoctorsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:Label ID="Label2" AssociatedControlID="RoomsComboBox" runat="server" CssClass="inline-label">محل حضور:</asp:Label>
                            <telerik:RadComboBox runat="server" ID="RoomsComboBox" DataTextField="Name" DataValueField="Id"
                                Width="90%" Skin="Office2007" SelectedValue='<%# Bind("RoomId") %>' DataSourceID="RoomsEntityDataSource">
                            </telerik:RadComboBox>
                        </div>
                        <div class="qsfexAdvEditControlWrapper">
                            <asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update">
                                <asp:Image runat="server" ID="Image4" ValidationGroup="Update" ImageUrl="App_Themes/Default/Images/ok.png"
                                    AlternateText="update"></asp:Image></asp:LinkButton>
                            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                                Style="margin-right: 8px;">
                                <asp:Image runat="server" ID="Image5" ImageUrl="App_Themes/Default/Images/cancel.png"
                                    AlternateText="cancel"></asp:Image></asp:LinkButton>
                        </div>
                    </div>
                </div>
            </InlineEditTemplate>
            <AppointmentTemplate>
                <div class="rsCustomAppointmentContainer">
                    <h2>
                        <%# Eval("Subject") %>
                    </h2>
                    <div>
                    </div>
                </div>
            </AppointmentTemplate>
        </telerik:RadScheduler>
        <asp:EntityDataSource ID="AppointmentsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="Appointments" EnableDelete="True"
            EnableInsert="True" EnableUpdate="True">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="AppointmentTypesEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="AppointmentTypes">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="RoomsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="Rooms">
        </asp:EntityDataSource>
        <asp:EntityDataSource ID="DoctorsEntityDataSource" runat="server" ConnectionString="name=DatabaseEntities"
            DefaultContainerName="DatabaseEntities" EntitySetName="Doctors">
        </asp:EntityDataSource>
    </div>
    </form>
</body>
</html>
